package com.zx.dao;

import com.zx.pojo.User;
import org.apache.ibatis.annotations.*;

import java.util.List;
import java.util.Map;

@Mapper
public interface UserMapper {

    /**
     * 查询
     * @return
     */
    @Select("select *from user")
    List<User>selectUser();

    /**
     * id查询
     * @param user
     * @return
     */
    @Select("select * from user where id=#{id}")
    Map<String,Object> IdselectUser(User user);
    /**
     * 注册
     * @param user
     */
    @Insert("insert into user (username,pwd) values(#{username},#{pwd})")
    void adduser(User user);

    /**
     * 查询是否有一致用户名
     * @param user
     * @return
     */
    @Select("select * from user where username = #{username}")
    List<User> Fituser(User user);

    /**
     * 登录
     * @param user
     * @return
     */
    @Select("select *from user where username = #{username} and pwd =#{pwd}")
    List<User> LoginUser(User user);

    /**
     * 修改
     * @param user
     */
    @Update("update user set username=#{username},pwd=#{pwd} where id=#{id}")
    void update(User user);

    /**
     * 删除
     * @param user
     */
    @Delete("delete from user where id=#{id}")
    void Delete(User user);

}
